//
//  UIImage+emoImage.m
// Halfarea
//
//  Created by Wang Xj on 14-3-25.
//
//

#import "UIImage+emoImage.h"
#import "AppDataManager.h"
#import "AppCommunicationManager.h"

@implementation UIImage (emoImage)

//检查图片是否缓存
+(UIImage *)imageWithUrl:(NSString *)imageUrl
{
    //1.查看缓存
    NSData * imageData = [MyAppDataManager imageDataForImageUrlStr:imageUrl withFolder:@"EmoFolder"];
    if (imageData)
    {
        return [UIImage imageWithData:imageData];
    }
    else
    {
        //下载
        return nil;
    }
}
//加载网络图片
+(UIImage *)imageWithUrl:(NSString *)imageUrl withDelegate:(id)controller
{
    //1.查看缓存
    NSData * imageData = [MyAppDataManager imageDataForImageUrlStr:imageUrl withFolder:@"EmoFolder"];
    if (imageData)
    {
        return [UIImage imageWithData:imageData];
    }
    else
    {
        //下载,并设置代理
        return nil;
    }
}

@end
